﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Form.aspx.cs" MasterPageFile="~/Form.Master" Inherits="BBPA.Admin.Store.Group_Buy.Form" %>
<%@ MasterType VirtualPath="~/Form.Master" %>
<%@ Register Src="~/Controls/DDL_Supplier.ascx" TagPrefix="uc1" TagName="DDL_Supplier" %>
<asp:Content ID="Content3" ContentPlaceHolderID="head" runat="server">
     <script>
         function Event_Amount_change() {
             $('[id$=tb_ExpectAmount]').bind('input propertychange', function () {
                 var amount = $(this).val();
                 if (amount == "") return;
                 var parent = $(this).parent().parent();
                 var price = parent.find(".lblprice").html();
                 var sellprice = parent.find(".lblsellprice").html();
                 var lbltotlprice = parseInt(amount) * parseFloat(price);
                 var js = parseInt(amount) * parseFloat(sellprice) - lbltotlprice;
                 if (lbltotlprice) {
                     parent.find(".lbltotalPrice").html(lbltotlprice.toFixed(2));
                     parent.find(".lbljs").html(js.toFixed(2));
                 }
                 //$('[id$=btnedit]').click();
                 allprice();

             });
             $(".formTable .fa-times").fastClick(function () {
                 $(this).parent().parent().parent().next("tr").remove();
                 $(this).parent().parent().parent().remove();
                 allprice();
                 //$('[id$=btnedit]').click();
             })
             $(".formTable [href-info]").fastClick(function () {
                 var me = $(this);
                 parent.open_popover(me, getAbsoluteUrl(me.attr("href-info")), "" + me.parents("tr").attr("data-row-title"), true);
             })
             $('[id$=tb_Description]').focusout(function () { $('[id$=btnedit]').click(); })
         }

         function allprice()
         {
             var allprice = 0;
             $(".lbltotalPrice").each(function () {
                 if (parseFloat($(this).html()))
                    allprice += parseFloat($(this).html());
             });
             $(".lblallprice").html(allprice.toFixed(2));
             $("#ctl00_cph_main_rp_Goods_ctl04_lblalltotalprice").html((allprice + 100).toFixed(2));
         }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cph_main" runat="server">
    <table class="formTable" border="1">
        <tr>
            <td class="td_title">团购名称：</td>
            <td style="font-size:16px;">
                 <asp:Label ID="lbltitle" runat="server" Text=""></asp:Label>
            </td>
            <td class="td_title">团购总金额：</td>
            <td style="font-size:16px; color:red;">
              <asp:Label ID="lblprice" runat="server" Text=""></asp:Label>
            </td>
        </tr>
         <tr>
            <td class="td_title">团购公告：</td>
            <td colspan="3">
                 <asp:Label ID="lblcontet" runat="server" Text=""></asp:Label>
            </td>
        </tr>
        <tr>
            <td class="td_title">已定金额：</td>
            <td style="font-size:16px; color:blue;">
                  <asp:Label ID="lblorderprice" runat="server" Text=""></asp:Label>
            </td>
            <td class="td_title">已付款金额：</td>
            <td style="font-size:16px; color:red;">
               <asp:Label ID="lblpayprice" runat="server" Text=""></asp:Label>
            </td>
        </tr>
         <tr>
            <td class="td_title">团购结束时间：</td>
            <td style="font-size:16px; color:blue;">
                 <asp:Label ID="lblendtime" runat="server" Text=""></asp:Label>
            </td>
            <td class="td_title">团购付款结束时间：</td>
            <td style="font-size:16px; color:red;">
              <asp:Label ID="lblendpaytime" runat="server" Text=""></asp:Label>
            </td>
        </tr>
        <tr>
            <td class="td_title">团购倒计时：</td>
            <td colspan="3" style="font-size:16px; color:red;">
                <asp:Label ID="Label3" runat="server" Text=""></asp:Label>
            </td>
        </tr>
    </table>

    
    <asp:Repeater ID="rp_Goods" runat="server" OnItemDataBound="rp_Goods_ItemDataBound"  >
        <HeaderTemplate>
            <table class="formTable haveBorder <%=rp_Goods.Items.Count==0?"hide":"" %>">
                <thead>
                    <tr>
                        <th>货品</th>
                        <th>原价</th>
                        <th>团购价</th>
                        <th>折扣</th>
                        <th>数量</th>
                        <th>节省</th>
                        <th>小计</th>
                        <th>操作</th>
                    </tr>
                </thead>
        </HeaderTemplate>
        <ItemTemplate>
            <tr data-key-id="<%#Eval("GoodsID") %>" data-row-title="<%#Eval("Name") %>">
                <td rowspan="2">
                    <asp:TextBox ID="tb_id" runat="server" CssClass="hide"  Text='<%#Eval("GoodsID") %>'></asp:TextBox>
                    <a href="###" href-info="/sys/goods/info.aspx?id=<%#Eval("GoodsID") %>&HideOrderForm=1" style="display: block; overflow: hidden; min-width: 200px;">
                        <div style="width: 80px; margin-right: 10px;" class=" inlineblock">
                            <img src="<%#Eval("PicURL") %>" /></div>
                        <div style="min-width: 100px;" class=" inlineblock"><%#Eval("Number") %><br>
                            <div style="line-height: initial;"><%#Eval("BrandName") %> <%#Eval("Name") %></div>
                        </div>
                    </a>
                </td>
                <td style="text-align: center;font-size:16px; color:red;"><asp:Label ID="lbl" CssClass="lblsellprice" runat="server" Text='<%#StringPlus.showCoin(Eval("sellprice")) %>'></asp:Label></td>
                <td style="text-align: center;font-size:16px; color:red;"><asp:Label ID="lblprice" CssClass="lblprice" runat="server" Text='<%#StringPlus.showCoin(Eval("gggoodprice")) %>'></asp:Label></td>
                <td style="text-align: center;font-size:16px; "><%# (Convert.ToDecimal(Eval("gggoodprice"))/Convert.ToDecimal(Eval("sellprice"))).ToString("N") %></td>
                 <td style="text-align: center;height:60px;">
                    <asp:TextBox ID="tb_ExpectAmount" runat="server" Style="width: 40px" CssClass="tb_ExpectAmount"></asp:TextBox></td>
                <td style="text-align: center;font-size:16px; "><asp:Label ID="Label1" CssClass="lbljs" runat="server" Text='0'></asp:Label></td>
                <td itemsum="1" class="text-error" style="text-align: center;font-size:16px; color:red;">
                    <asp:Label ID="lbltotalPrice" runat="server" Text="" CssClass="lbltotalPrice"></asp:Label>
                </td>
                <td style="text-align: center;" ><span runat="server" id="item_del"><a href="###" class="fa fa-times nowrap">删除</a></span></td>
            </tr>
            <tr><td colspan="4"><asp:TextBox ID="tb_Description" runat="server"  TextMode="MultiLine" style="width:100%;margin-left:-10px;"></asp:TextBox></td></tr>
        </ItemTemplate>
        <FooterTemplate>
            </table>
                <h3 style="text-align: right; padding-right: 56px;" class="text-error <%=rp_Goods.Items.Count==0?"hide":"" %>">
                    运费：100 
                    货款：<asp:Label ID="lblallprice" runat="server" Text="" CssClass="lblallprice"></asp:Label>
                    总计：<asp:Label ID="lblalltotalprice" runat="server" Text=""> </asp:Label>
                </h3>
            <h4 class="text-error <%=rp_Goods.Items.Count==0?"":"hide" %>">还没有选择要采购的商品</h4>
        </FooterTemplate>
    </asp:Repeater>

    
     <div class="control-group">
        <label class="control-label">
          
        </label>
        <div class="controls">
            <asp:Button ID="btnSub" runat="server" Text="提交" OnClick="btnSub_Click" CssClass="btn btn-primary"/>
        </div>
    </div>
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="cph_bottom" runat="server">
</asp:Content>
